import request from '@/utils/request'

// 获取报检单
export function ipqcinspectionlot(data){
	return request({
		url: '/api/Business/ipqcinspectionlot',
		method: 'get',
		data
	})
}

//详情
export function getInfo(id) {
	return request({
		url: `/api/Business/ipqcinspectionlot/${id}`,
		method: 'get',
		options: {
			load: false
		}
	})
}


//详情列表
export function getInspectionList(code) {
	return request({
		url: `/api/Business/ipqcinspectionitem/${code}`,
		method: 'get',
		options: {
			load: false
		}
	})
}

//单条保存
export function inspectionitem(data) {
	return request({
		url: `/api/Business/ipqcinspectionitem`,
		method: 'post',
		data,
		options: {
			load: false
		}
	})
}

//检验任务保存
export function saveinspectionlot(data) {
	return request({
		url: `/api/Business/ipqcinspectionlot`,
		method: 'put',
		data,
		options: {
			load: false
		}
	})
}

//检验任务提交
export function submitinspectionlot(data) {
	return request({
		url: `/api/Business/ipqcinspectionlot`,
		method: 'post',
		data,
		options: {
			load: false
		}
	})
}

// 修改抽检数量
export function SamplingQty(data){
	return request({
		url:'/api/Business/ipqcinspectionitem/SamplingQty',
		method: 'put',
		data,
		options: {
			load: false
		}
	})
}

// 获取所有启用的检验项目列表
export function GetInspectionPro(){
	return request({
		url:'/api/BaseData/innspectionitems/All',
		method:'get',
		options:{
			load:false
		}
	})
}

// 获取所有启用的检验条目列表
export function GetInspectionItem(){
	return request({
		url:'/api/BaseData/innspectionentry/All',
		method:'get',
		options:{
			load:false
		}
	})
}

// 获取所有检验方法
export function GetInspectionMethod(){
	return request({
		url:'/api/BaseData/innspectionmethod/ALL',
		method:'get',
		options:{
			load:false
		}
	})
}

// 提交抽样方案表单
export function SubmitsamplingType(data){
	return request({
		url:'/api/Business/ipqcinspectionitem/addItem',
		method:'post',
		data,
		options:{
			load:false
		}
	})
}


// 关闭检验批
export function closeIpqcInspectionlot(data){
	return request({
		url:'/api/Business/ipqcinspectionlot/close',
		method:'post',
		data,
		options:{
			load:false
		}
	})
}

// 获取缺陷记录列表
export function getInspectionitemdefectList(data) {
    return request({
        url: `/api/Business/ipqcinspectionitemdefect`,
        method: 'get',
        data,
		options: {
			load: false
		}
    })
}

// 保存缺陷记录
export function createInspectionitemdefect(data) {
    return request({
        url: '/api/Business/ipqcinspectionitemdefect',
        method: 'post',
        data
    })
}

// 获取所有缺陷类型
export function getDefactAll(data) {
      return request({
			url: `/api/BaseData/Defect/All`,
			method: 'get'
	});
}

// 删除缺陷记录
export function deleteInspectionitemdefect(id){
	return request({
		url:'/api/Business/ipqcinspectionitemdefect/'+id,
		method:'delete'
	})
}
